package com.pantuo.common.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class JsonResult {

    private Integer state = 200; //200：ok, 500：error
    private String message = "ok"; //状态信息
    private Object data; //业务层返回正确的响应数据

    public JsonResult(String message) { //new JsonResult("update ok");
        this.message = message;
    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Integer code, String message){
        this.state = code;
        this.message = message;
    }

    public JsonResult(Throwable e) {
        //this.state = 500;
        this.message = e.getMessage();
    }

}
